﻿#VisualFreeBasic_Form#  Version=5.6.6
Locked=0

[Form]
Name=Form1
ClassStyle=CS_VREDRAW,CS_HREDRAW,CS_DBLCLKS
ClassName=
WinStyle=WS_THICKFRAME,WS_CAPTION,WS_SYSMENU,WS_MINIMIZEBOX,WS_MAXIMIZEBOX,WS_CLIPSIBLINGS,WS_CLIPCHILDREN,WS_VISIBLE,WS_EX_WINDOWEDGE,WS_EX_CONTROLPARENT,WS_EX_LEFT,WS_EX_LTRREADING,WS_EX_RIGHTSCROLLBAR,WS_POPUP,WS_SIZEBOX
Style=3 - 常规窗口
Icon=
Caption=TS解密
StartPosition=1 - 屏幕中心
WindowState=0 - 正常
Enabled=True
Repeat=False
Left=0
Top=0
Width=608
Height=445
TopMost=False
Child=False
MdiChild=False
TitleBar=True
SizeBox=True
SysMenu=True
MaximizeBox=True
MinimizeBox=True
Help=False
Hscroll=False
Vscroll=False
MinWidth=0
MinHeight=0
MaxWidth=0
MaxHeight=0
NoActivate=False
MousePass=False
TransPer=0
TransColor=SYS,25
Shadow=0 - 无阴影
BackColor=SYS,15
MousePointer=0 - 默认
Tag=
Tab=True
ToolTip=
ToolTipBalloon=False
AcceptFiles=False

[TextBox]
Name=Text1
Index=-1
Style=3 - 凹边框
TextScrollBars=0 - 无滚动条
Text=A:\cache
Enabled=True
Visible=True
MaxLength=0
ForeColor=SYS,8
BackColor=SYS,5
Font=微软雅黑,9,0
TextAlign=0 - 左对齐
PasswordChar=
Locked=False
HideSelection=True
Multiline=False
Uppercase=False
Lowercase=False
Number=False
AutoHScroll=True
AutoVScroll=False
Left=128
Top=68
Width=345
Height=25
Layout=0 - 不锚定
MousePointer=0 - 默认
Tag=
Tab=True
ToolTip=
ToolTipBalloon=False
LeftMargin=0
RightMargin=0
AcceptFiles=False

[Button]
Name=Command1
Index=-1
Caption=选择文件夹
TextAlign=1 - 居中
Ico=
Enabled=True
Visible=True
Default=False
OwnDraw=False
MultiLine=False
Font=微软雅黑,9,0
Left=481
Top=68
Width=86
Height=25
Layout=0 - 不锚定
MousePointer=0 - 默认
Tag=
Tab=True
ToolTip=
ToolTipBalloon=False

[Button]
Name=Command2
Index=-1
Caption=解密
TextAlign=1 - 居中
Ico=
Enabled=True
Visible=True
Default=False
OwnDraw=False
MultiLine=False
Font=微软雅黑,9,0
Left=128
Top=277
Width=110
Height=40
Layout=0 - 不锚定
MousePointer=0 - 默认
Tag=
Tab=True
ToolTip=
ToolTipBalloon=False

[TextBox]
Name=Text2
Index=-1
Style=3 - 凹边框
TextScrollBars=0 - 无滚动条
Text=
Enabled=True
Visible=True
MaxLength=0
ForeColor=SYS,8
BackColor=SYS,5
Font=微软雅黑,9,0
TextAlign=0 - 左对齐
PasswordChar=
Locked=False
HideSelection=True
Multiline=False
Uppercase=False
Lowercase=False
Number=False
AutoHScroll=True
AutoVScroll=False
Left=128
Top=112
Width=345
Height=20
Layout=0 - 不锚定
MousePointer=0 - 默认
Tag=
Tab=True
ToolTip=
ToolTipBalloon=False
LeftMargin=0
RightMargin=0
AcceptFiles=False

[TextBox]
Name=Text3
Index=-1
Style=3 - 凹边框
TextScrollBars=0 - 无滚动条
Text=
Enabled=True
Visible=True
MaxLength=0
ForeColor=SYS,8
BackColor=SYS,5
Font=微软雅黑,9,0
TextAlign=0 - 左对齐
PasswordChar=
Locked=False
HideSelection=True
Multiline=False
Uppercase=False
Lowercase=False
Number=False
AutoHScroll=True
AutoVScroll=False
Left=128
Top=154
Width=345
Height=30
Layout=0 - 不锚定
MousePointer=0 - 默认
Tag=
Tab=True
ToolTip=
ToolTipBalloon=False
LeftMargin=0
RightMargin=0
AcceptFiles=False

[Button]
Name=Command3
Index=-1
Caption=删除
TextAlign=1 - 居中
Ico=
Enabled=True
Visible=True
Default=False
OwnDraw=False
MultiLine=False
Font=微软雅黑,9,0
Left=257
Top=277
Width=86
Height=40
Layout=0 - 不锚定
MousePointer=0 - 默认
Tag=
Tab=True
ToolTip=
ToolTipBalloon=False

[Button]
Name=Command4
Index=-1
Caption=重命名
TextAlign=1 - 居中
Ico=
Enabled=True
Visible=True
Default=False
OwnDraw=False
MultiLine=False
Font=微软雅黑,9,0
Left=363
Top=277
Width=110
Height=40
Layout=0 - 不锚定
MousePointer=0 - 默认
Tag=
Tab=True
ToolTip=
ToolTipBalloon=False

[Label]
Name=Label1
Index=-1
Style=0 - 无边框
Caption=TS文件目录
Enabled=True
Visible=True
ForeColor=SYS,8
BackColor=SYS,25
Font=微软雅黑,9,0
TextAlign=4 - 置中
Prefix=True
Ellipsis=False
Left=15
Top=68
Width=100
Height=25
Layout=0 - 不锚定
MousePointer=0 - 默认
Tag=
ToolTip=
ToolTipBalloon=False

[Label]
Name=Label2
Index=-1
Style=0 - 无边框
Caption=KEY
Enabled=True
Visible=True
ForeColor=SYS,8
BackColor=SYS,25
Font=微软雅黑,9,0
TextAlign=4 - 置中
Prefix=True
Ellipsis=False
Left=15
Top=112
Width=100
Height=20
Layout=0 - 不锚定
MousePointer=0 - 默认
Tag=
ToolTip=
ToolTipBalloon=False

[Label]
Name=Label3
Index=-1
Style=0 - 无边框
Caption=IV
Enabled=True
Visible=True
ForeColor=SYS,8
BackColor=SYS,25
Font=微软雅黑,9,0
TextAlign=4 - 置中
Prefix=True
Ellipsis=False
Left=15
Top=154
Width=100
Height=30
Layout=0 - 不锚定
MousePointer=0 - 默认
Tag=
ToolTip=
ToolTipBalloon=False

[Button]
Name=Command5
Index=-1
Caption=选择Key文件
TextAlign=1 - 居中
Ico=
Enabled=True
Visible=True
Default=False
OwnDraw=False
MultiLine=False
Font=微软雅黑,9,0
Left=481
Top=110
Width=86
Height=25
Layout=0 - 不锚定
MousePointer=0 - 默认
Tag=
Tab=True
ToolTip=
ToolTipBalloon=False


[AllCode]
'这是标准的工程模版，你也可做自己的模版。
'写好工程，复制全部文件到VFB软件文件夹里【template】里即可，子文件夹名为 VFB新建工程里显示的名称
'快去打造属于你自己的工程模版吧。

Function tsfjm(TXT As String) As Long
   Exec(ExePath & "\bin\openssl.exe" ,"aes-128-cbc -d -in " & TXT & " -out " & TXT & "d -nosalt -iv " & Text3.Text & " -K "& Text2.Text)
   Function = False
End Function

Sub Form1_Command1_BN_Clicked(hWndForm As hWnd ,hWndControl As hWnd) '单击
   Dim nfolder As String = FF_BrowseForFolder(hWndForm ,"Choose" ,ExePath)
   Text1.Text = nfolder
End Sub

Sub Form1_Command2_BN_Clicked(hWndForm As hWnd ,hWndControl As hWnd) '单击
   Dim folder123 As String = Text1.Text
   Dim lName()   As WIN32_FIND_DATAW ,i As Long
   GetDIR(folder123 & "\*.ts" ,lName())
   For i = 0 To UBound(lName)
      If (lName(i).dwFileAttributes And fbDirectory) <> 0 Then
         MsgBox("目录:" & lName(i).cFileName)
      Else
         tsfjm(folder123 & "\" & lName(i).cFileName)
      End If
   Next
End Sub

Sub Form1_Command3_BN_Clicked(hWndForm As hWnd ,hWndControl As hWnd) '单击
   Shell("del /f/q " & Text1.Text & "\*.ts")
End Sub

Sub Form1_Command4_BN_Clicked(hWndForm As hWnd ,hWndControl As hWnd) '单击
   Shell("cd /d """& Text1.Text & """ && ren *.tsd *.ts")
End Sub

Sub Form1_Command5_BN_Clicked(hWndForm As hWnd ,hWndControl As hWnd) '单击
   Text2.Text = ""
   Dim As String nFilename = FF_OpenFileDialog(hWndForm ,"Select Key File" , ,ExePath ,"任意文件(*)|*" , ,0 ,1)
   Dim As String addd
   Open nFilename For Binary Access Read As #1
   Dim txt As String
   If LOF(1) > 0 Then
      ''我们的字符串具有与文件以字节为单位的字符数
      txt = String(LOF(1) ,0)
      ''txt的大小是已知的。整个字符串填充文件数据
      Get #1 , ,txt
   End If
   Dim As LongInt i
   For i = 1 To LOF(1)
      addd = addd & WHex(Asc(txt ,i) ,2)
   Next
   Close #1
   Text2.Text = LCase(addd)
   
End Sub